<template>
	<!-- 更换手机 -->
	<view class="phone">
		<!-- #ifdef APP-PLUS -->
		<top-set></top-set>
		<tab-top fixed="true" title="更换手机"></tab-top>
		<!-- #endif -->
		<view class="bg_01"></view>
		<view class="set_box">
			<view class="set_item">
				<view class="set_item_left">
					<text>新手机号</text>	
					<input class="input" type="text" value="" v-model="phone" placeholder="请输入手机号" maxlength="10" minlength="2"/>
				</view>
				<view class="set_item_reght" @tap="security">
					<text :style="{color: show ? '#999':''}">{{securityData}}</text>
					<text style="color:#999;" v-if="show">s</text>
				</view>
			</view>
			<view class="set_item">
				<view class="set_item_left">
					<text style="width: 4em;">验证码</text>
					<input class="input" placeholder="请输入验证码" type="number" value="" maxlength="10" minlength="2"/>
				</view>
			</view>
		</view>	
		<button class="button" @tap="changePhone">确定</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				securityData:'获取验证码',
				show:false,
				phone:''
			}
		},
		methods: {
			security(){
				/**
				 * 获取验证码
				 */
				uni.showToast({
					title: '获取验证码'
				});
				this.show = !this.show
				this.securityData = 5
				let d = setInterval(()=>{
					if(this.securityData > 1){
						this.securityData --
					}else{
						this.securityData ='获取验证码'
						this.show = !this.show
						clearInterval(d)
					}
				},1000)
			},
			changePhone(){
				/**
				 * 提交
				 */
				uni.navigateBack({
					delta: 1
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.phone{
	font-family: PingFang-SC-Medium;
	font-weight: normal;
	font-stretch: normal;
	letter-spacing: 0px;
	color: #333333;
	.set_box{
		width: 702upx;
		height: 296upx;
		padding: 0 24upx;
		.set_item{
			height: 98upx;
			border-bottom: 1upx solid #e5e5e5;
			line-height: 98upx;
			display: flex;
			justify-content: space-between;
			.set_item_left{
				font-size: 28upx;
				display: flex;
				align-items: center;
				.input[type]{
					margin-left: 40upx; 
					font-size: 30upx;
					line-height: 98upx;
					height: 30upx;
				}
			}
			.set_item_reght{
				font-size: 28upx;
				color: #3595f9;
				align-items: center;
			}
		}
	}
	.bg_01{
		width: 750upx;
		height: 30upx;
		background-color: #f0f0f0;
	}
	.button{
		margin-top: 116upx;
		width: 540upx;
		height: 90upx;
		border-radius: 8upx;
		font-size: 32upx;
		line-height: 90upx;
		background-color: #3595f9;
		color: #fefefe;
	}
}
</style>
